package com.zs.demo111.web;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

public class MQConsume {

    @RabbitListener(bindings = {@QueueBinding(value = @Queue(value = "pubSub1",durable = "true"),
            exchange = @Exchange(value = "fanoutTest",type = ExchangeTypes.FANOUT))
            })
        public void recvFanoutMessage(String result){
        System.out.println("fanout1"+result);
    }

    @RabbitListener(bindings = {@QueueBinding(value = @Queue(value = "pubSub2",durable = "true"),
            exchange = @Exchange(value = "fanoutTest",type = ExchangeTypes.FANOUT))
    })
    public void recvFanoutMessage1(String result){
        System.out.println("fanout2"+result);
    }

    @RabbitListener(bindings = {@QueueBinding(value = @Queue(value = "pubSub3",durable = "true"),
            exchange = @Exchange(value = "fanoutTest",type = ExchangeTypes.FANOUT))
    })
    public void recvFanoutMessage2(String result){
        System.out.println("fanout3"+result);
    }

}
